package cn.edu.zafu.bigdata.x.wupeng.b;

//其实是一个抽象类
abstract class classA{
    void methodA(){};
}
class classB extends classA{
    void methodA(){
        System.out.println("This is ClassB");
    };
}
@FunctionalInterface
interface IntBinaryOperator {
    int applyAsInt(int a, int b);
}
public class TryAnonymous {
    public static void main(String[] args) {
        classA obj = new classB();
        obj.methodA();

        classA obj2 = new classA(){
            void methodA(){
                System.out.println("This is Class Anonymous");
            };
        };
        obj2.methodA();

        //用lambda实现返回i和j的和
        //IntBinaryOperator是定义的函数式接口
        IntBinaryOperator add = (a, b) -> a + b;
        for (int i=0;i<10;i++){
            for (int j=0;j<10;j++){
                System.out.println(add.applyAsInt(i,j));
            }
        }
    }
}
